package com.decades.application.main;

import com.jakewharton.salvage.ScreenSizeUntil;
import com.decades.application.main.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;

public class SplashScreenActivity extends Activity {
	private final int SPLASH_DISPLAY_LENGHT = 1000;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setContentView(R.layout.activity_splash_screen);
		System.gc();
//		ImageView logo = (ImageView) findViewById(R.id.logo);
//		int h = (25 * new ScreenSizeUntil(getApplicationContext(), this)
//				.getScreenHeight()) / 100;
//		int w = (45 * new ScreenSizeUntil(getApplicationContext(), this)
//				.getScreenWidth()) / 100;
//		logo.setMinimumWidth(w);
//		logo.setMinimumHeight(h);
		/*
		 * New Handler to start the Menu-Activity and close this Splash-Screen
		 * after some seconds.
		 */
		new Handler().postDelayed(new Runnable() {
			@Override
			public void run() {
				/* Create an Intent that will start the Menu-Activity. */
				Intent mainIntent = new Intent(SplashScreenActivity.this,
						NrctMainActivity.class);
				startActivity(mainIntent);
				overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
				finish();
			}
		}, SPLASH_DISPLAY_LENGHT);
	}

}
